package org.hdlh.constants;

/**
 * 请求类型
 */
public enum ReqType {
    //request
    REQUEST((byte) 1),
    //response
    RESPONSE((byte) 2),
    //心跳
    HEARTBEAT((byte) 3);


    private byte code;

    ReqType(byte code) {
        this.code = code;
    }

    public byte code() {
        return code;
    }


    public static ReqType findByCode(int code){
        for(ReqType reqType : ReqType.values()){
            if(reqType.code == code){
                return reqType;
            }
        }
        return null;
    }
}
